﻿using System;
using System.Collections;
using System.Configuration;
using System.ComponentModel;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class Controls_TipMessage_TipMessage : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        //pnlTipMessage.Visible = false;
        pnlTipMessage.Style.Value = Style;
    }

    private string style;
    [Browsable(true)]
    [Category("Behavior")]
    [Description("默认模版")]
    [DefaultValue("")]
    public string Style
    {
        get { return style; }
        set { style = value; }
    }

    public void ShowMessage(string message, int fadeOutDelay)
    {
        //event order 2
        if (string.IsNullOrEmpty(message))
        {
            pnlTipMessage.Visible = false;
            return;
        }

        pnlTipMessage.Visible = true;
        string script = "Openfree.prototype.AnimationFadeOut('{0}', {1})";
        script = string.Format(script, pnlTipMessage.ClientID, fadeOutDelay);
        script = JavaScript.InBox(script);
        literalMessage.Text = message;
        Page.ClientScript.RegisterStartupScript(this.GetType(), "TipMessage", script);
    }
}
